import os

from flask import Flask


def create_app(test_config=None):
    # create and configure the app
    app = Flask(__name__, instance_relative_config=True)
    app.config.from_mapping(
        SECRET_KEY='NLP group project by 赫尔墨斯',
    )

    # ensure the instance folder exists
    try:
        os.makedirs(app.instance_path)
    except OSError:
        pass
    print('instance路径:',app.instance_path)

    # a simple page that says hello
    @app.route('/proj_init')
    def hello_world():
        return '<p>赫尔墨斯小组 GUI</p>'

    from . import post_contents
    app.register_blueprint(post_contents.bp)
    return app